<script>
$('form').each(function(){
    if($(this).data('validate') !== false){
        $(this).bootstrapValidator();
    }
})

$('form').on('success.form.bv', function(e){
    var _form = $(this);
    if(_form.data('ajax') !== false){
        e.preventDefault();
        var url = _form.attr('action');
        $.ajax({
            url:url,
            dataType:"json",
            data:_form.serialize(),
            type:'post',
            success:function(rs){
                if(rs.success){
                    showMessage('success',rs.msg,rs.url);
                }
                else{
                    showMessage('error',rs.msg,'');
                    // $("#v_code_img").click();
                }
            }
        });
        return false;
    }
});
</script>
</body>
</html>